package com.kaiyiweitong.tongxing.activity.my.setting;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.kaiyiweitong.tongxing.R;
import com.kaiyiweitong.tongxing.base.BaseActivity;
import com.kaiyiweitong.tongxing.util.CommonUtil;
import com.kaiyiweitong.tongxing.util.MyTextUtils;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/12/19 0019.
 */

public class SetAddressActivity extends BaseActivity {
    @Bind(R.id.contact_person)
    EditText mContactPerson;
    @Bind(R.id.phone_num)
    EditText mPhoneNum;
    @Bind(R.id.choose_area)
    TextView mChooseArea;
    @Bind(R.id.detailed_address)
    EditText mDetailedAddress;
    @Bind(R.id.iv_choose)
    ImageView mIvChoose;

    private boolean isChosen;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_set_address);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.choose_area, R.id.detailed_address, R.id.ll_choose, R.id.save})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.choose_area:

                break;
            case R.id.detailed_address:

                break;
            case R.id.ll_choose:
                if (isChosen) {
                    Glide.with(this).load(R.mipmap.uncheck).into(mIvChoose);
                } else {
                    Glide.with(this).load(R.mipmap.chosen).into(mIvChoose);
                }
                isChosen = !isChosen;
                break;
            case R.id.save:
                if (MyTextUtils.checkTextContent(mContactPerson).equals("")) {
                    CommonUtil.toast(this, R.string.contact_person_not_blank);
                } else if (MyTextUtils.checkTextContent(mPhoneNum).equals("")) {
                    CommonUtil.toast(this, R.string.phone_not_blank);
                } else if (MyTextUtils.checkTextContent(mChooseArea).equals("")) {
                    CommonUtil.toast(this, R.string.area_not_blank);
                } else if (MyTextUtils.checkTextContent(mDetailedAddress).equals("")) {
                    CommonUtil.toast(this, R.string.address_not_blank);
                } else {

                }
                break;
        }
    }
}
